/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package LiveReservations.control.mocks;

import LiveReservations.control.info.LoginInfo;
import java.util.Arrays;
import LiveReservations.model.clients.RegisteredClient;

/**
 *
 * @author tony
 */
public class LoginMock {

    private RegisteredClient client;

    public LoginMock() {
        initFakeRegisteredClient();
    }

    private void initFakeRegisteredClient() {
        client = new RegisteredClient("Registerd", "Client");
        client.setUsername("username");
        client.setPassword("password".toCharArray());
    }

    /**
     * 
     * @param logInfo
     * @return 
     */
    public boolean login(LoginInfo logInfo) {
        RegisteredClient regClient = (RegisteredClient) logInfo.getClient();
        boolean usernameMatch = regClient.getUsername().matches(client.getUsername());
        boolean passwordEqual = Arrays.equals(regClient.getPassword(), client.getPassword());
        return usernameMatch && passwordEqual;
    }

}
